package com.harry.resource.inner.entity;

import static com.harry.configuration.ConstSettings.MEDIUM_LENGTH;
import static com.harry.configuration.ConstSettings.MINI_LENGTH;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.harry.basis.BasePoEntity;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Entity
public class InnerTimerJob extends BasePoEntity {

	private static final long serialVersionUID = 1L;

	@Column(length = MEDIUM_LENGTH, unique = true, nullable = false, updatable = false)
	private String name;

	@Column(length = MINI_LENGTH, nullable = false)
	private String cron;

	@Column(nullable = false)
	private Boolean ifRunning = false;

	@Column(insertable = false, updatable = false)
	private Boolean lastSuccess;

	@Column(insertable = false, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date lastBeginTime;

	@Column(insertable = false, updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date lastEndTime;

	@Column(insertable = false, updatable = false)
	private Integer lastSpendSeconds;

	@Column(columnDefinition = TEXT_COLUMN, insertable = false, updatable = false)
	private String lastResult;
}
